/*
 * Created on Apr 2, 2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code  Generation&gt;Code and Comments
 */
package com.ba360.portal.database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.ResourceBundle;

import javax.naming.Context;

import javax.sql.DataSource;

import com.ba360.portal.util.Log;



/**
 * @author ROnat
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class DBConnectionImpl {

	public static Connection conn = null;
	public Connection getConnection() throws Exception {
		Log.init(this.getClass());
		Context context = null;
		DataSource ds = null;
		//if (conn == null || conn.isClosed()) {
		 ResourceBundle rb = ResourceBundle.getBundle("ApplicationResources");
		//Class.forName( "org.gjt.mm.mysql.Driver" );
		Class.forName( "com.mysql.jdbc.Driver");

		Log.info("DBConnectionImpl DBURL: "+rb.getString("DBURL"));
        // Modified by Arun on 07-MAY-2009 According to his machine configuration.,...
		//Connection con = DriverManager.getConnection(rb.getString("DBURL"),"root","");
		Connection con = DriverManager.getConnection(rb.getString("DBURL"),"root","test");
		 //Connection con = DriverManager.getConnection(rb.getString("DBURL"),"portal","p0rtal");

	      // initialize the Connection, with our DB info ...

		/*String dataSource = rb.getString("DataSourceJNDI");
		try {

			context = new InitialContext();
			ds = (DataSource) context.lookup(dataSource);
			conn = ds.getConnection();
		} catch (Exception e) {
			Log.error(e.getMessage());
			throw e;
		}*/
		//}
		return con;
	}

}